<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>角色列表</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="/static/layui/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="/static/layui/css/public.css" media="all" />
</head>
<body class="childrenBody">
<form class="layui-form">
    <blockquote class="layui-elem-quote quoteBox">
        <form class="layui-form">
            <div class="layui-inline">
                <div class="layui-input-block layui-inline">
                    <select id="type" lay-verify="required">
                        <option value="请选择权限类别"></option>
                        <option value="menu">menu</option>
                        <option value="permission">permission</option>
                    </select>
                </div>
                <div class="layui-input-inline">
                    <input type="text" class="layui-input searchVal" id="name" placeholder="请输入权限名称" />
                </div>

                <a class="layui-btn search_btn" data-type="reload"  id="searchVal">搜索</a>
            </div>
        </form>
    </blockquote>
    <table id="permissionList" lay-filter="permissionList"></table>
    <!--操作-->
    <%--<script type="text/html" id="permissionListBar">--%>
        <%--<shiro:hasPermission name="per:del">--%>
            <%--<a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="del">删除</a>--%>
        <%--</shiro:hasPermission>--%>
    <%--</script>--%>
</form>
<script type="text/javascript" src="/static/layui/layui/layui.js"></script>
<script>
    layui.use(['form','layer','laydate','table','laytpl'],function(){
        var form = layui.form,
            layer = parent.layer === undefined ? layui.layer : top.layer,
            $ = layui.jquery,
            laytpl = layui.laytpl,
            table = layui.table,
            laydate=layui.laydate;

        //角色列表
        var tableIns = table.render({
            elem: '#permissionList',
            url : '/permission/permissions',
            cellMinWidth : 95,
            page : true,
            height : "full-125",
            limits : [5,10,15,20,25],
            limit : 5,
            id : "permissionListTable",
            cols : [[
                {type: "checkbox", fixed:"left", width:50},
                {field: 'type', title: '权限级别', minWidth:100, align:"center"},
                {field: 'name', title: '权限名称', minWidth:100, align:"center"},
                {field: 'href', title: '链接地址', minWidth:100, align:"center"},

//                {title: '操作', minWidth:100, templet:'#permissionListBar',fixed:"right",align:"center"}
            ]]
        });

        //搜索
        $("#searchVal").click(function () {
            var type=$('#type').val();
            var name=$('#name').val();
            console.log(name);
            console.log(type);

            tableIns.reload({
                where:{
                    type:type,
                    name:name
                }
            })
        });

    })

</script>
</body>
</html>